package com.example.vspm.controller;

import com.example.vspm.entity.TaskForm;
import com.example.vspm.service.impl.SenderServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/sender")
public class SenderController {
    @Autowired
    private SenderServiceImpl ssi;
    @RequestMapping("/index")
    public String indexAction(){
        return "sender/index";

    }
    @RequestMapping("/list")
    public String test(){
        return  "sender/list";
    }
    @RequestMapping("/delete")
    public String deleteAction(int id){
        return "sender/delete";
    }
    @RequestMapping("/back-ground-management")
    public String backGroundManagementAction( Model model,int state){
        List<TaskForm> formList = ssi.tasks(state);
        model.addAttribute("formList",formList);
        return "sender/back-ground-managemrnt";
    }
    @RequestMapping("/findhistory")
    public String findHistory(Model model,int pid2){
        List<TaskForm> formList = ssi.findByPid2(pid2);
        model.addAttribute("formList",formList);
        return "sender/list";
    }

}
